﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace Adalbertus.Extensions
{
    public static class DateTimeExtensions
    {
        public static bool IsBetween(this DateTime date, DateTime fromDate, DateTime toDate)
        {
            Contract.Requires<ArgumentNullException>(date != null, "date");
            Contract.Requires<ArgumentNullException>(fromDate != null, "fromDate");
            Contract.Requires<ArgumentNullException>(toDate != null, "toDate");

            if ((date >= fromDate) && (date <= toDate))
            {
                return true;
            }
            return false;
        }
    }
}
